/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.StrokeLineCap;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.control.Label;
import javafx.scene.layout.LayoutInfo;
import javafx.scene.text.Font;

/**
 * @author Sik
 */

public class ConquestArrow extends Group
{
    public-init var width : Number;
    public-init var height : Number;
    public var fillColor : Color;
    public var strokeColor : Color;
    public var txtColor : Color = Color.BLACK;

    public var cost : String;

    public var arrow : Polygon =
    Polygon
    {
        onMouseEntered: function(e:MouseEvent) : Void
        {
        }
        onMouseExited : function(e:MouseEvent) : Void
        {
        }
        onMouseClicked: function(e:MouseEvent) : Void
        {
           
        }
        pickOnBounds:true
	points: bind [ 0,(0.25*height), (0.66*width),(0.25*height), (0.66*width),0, width,(height/2), (0.66*width),height, (0.66*width),(0.75*height), 0,(0.75*height) ]
	fill: bind fillColor
        stroke: bind strokeColor
        strokeWidth: 4
        strokeLineCap: StrokeLineCap.ROUND
        opacity: 0.7
    }

    var value : Label =
    Label
    {
        layoutInfo: LayoutInfo
        {
            width: width
            height: height
        }

        text: bind cost
        textFill: txtColor
        font : Font
        {
            name: "Impact"
            size: 18
        }
        hpos: HPos.CENTER
        vpos: VPos.CENTER
    }

    public function antiRotate(angle : Number) : Void
    {
        value.rotate = - angle;
    }

    init
    {
        content =
            [
                arrow, value
            ]
    }
}
